const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: true,
      autoIncrement: false,
      comment: "饲料编号",
      field: "code"
    },
    src_name: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "采购来源企业名称",
      field: "src_name"
    },
    factory_code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "厂商识别码",
      field: "factory_code"
    },
    date_buy: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 0,
      primaryKey: false,
      autoIncrement: false,
      comment: "购买日期",
      field: "date_buy"
    },
    num_buy: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "购买量",
      field: "num_buy"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,
  
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,
 
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "feeds_buy",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const FeedsBuyModel = sequelize.define("feeds_buy_model", attributes, options);
  return FeedsBuyModel;
};